home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / foss11b3.zip / DEVELOP / UTILCOLL / STATCONV.PAS < prev    next >
Pascal/Delphi Source File  |  1995-10-20  |  18KB  |  549 lines

  1. {$M 32768,0,655360}
  2. program StatConv;
  3. uses
  4.   TParam, TFileIO,
  5.   Bits,
  6.   Types, ApiInt;
  7.  
  8. type
  9.   PStatConvert    = ^TStatConvert;
  10.   TStatConvert    = object
  11.     NodeNumber    : Word;
  12.     StatType      : ( Clean, PCB12, PCB14, MG );
  13.  
  14.     constructor Init;
  15.     destructor Done;
  16.  
  17.     procedure ReadParams;
  18.     procedure MakeFiles;
  19.   end;
  20.  
  21.   BasArray        = array[1.. 4] of byte;
  22.   Ascii2          = array[1.. 2] of char;
  23.   Ascii4          = array[1.. 4] of char;
  24.   Ascii5          = array[1.. 5] of char;
  25.   Ascii6          = array[1.. 6] of char;
  26.   Ascii8          = array[1.. 8] of char;
  27.   Ascii12         = array[1..12] of char;
  28.   Ascii13         = array[1..13] of char;
  29.   Ascii15         = array[1..15] of char;
  30.   Ascii18         = array[1..18] of char;
  31.   Ascii24         = array[1..24] of char;
  32.   Ascii25         = array[1..25] of char;
  33.   Ascii27         = array[1..27] of char;
  34.   Ascii30         = array[1..30] of char;
  35.   String80        = string[80];
  36.   FileNameType    = string[80];
  37.  
  38. var
  39.   StatConvert      : PStatConvert;
  40.  
  41. constructor TStatConvert.Init;
  42. begin
  43.   dllInit( '', 0 );
  44. end; { contructor Init }
  45.  
  46. destructor TStatConvert.Done;
  47. begin
  48. end; { destructor Done }
  49.  
  50. procedure TStatConvert.ReadParams;
  51. begin
  52.   if Par^.SwAct['T'] then
  53.     if ( Par^.SwStr['T'] = 'PCB12' ) then StatType := PCB12
  54.     else if ( Par^.SwStr['T'] = 'PCB14' ) then StatType := PCB14
  55.     else if ( Par^.SwStr['T'] = 'MG' ) then StatType := MG
  56.     else StatType := PCB14
  57.   else StatType := PCB14;
  58.  
  59.   if Par^.SwAct['C'] then StatType := Clean;
  60.  
  61.   NodeNumber := S2I( Par^.Str[1] );
  62. end; { procedure ReadParams }
  63.  
  64. procedure TStatConvert.MakeFiles;
  65. var
  66.   SysCfg           : SysCfgT;
  67.   NodeCfg          : ModCfgT;
  68.   NStat            : NodeStat;
  69.   User             : LocUsers;
  70.   BBSDir           : string;
  71.   FileDir          : string;
  72.  
  73.   Procedure MKS(PReal : Real; Var BReal : BasArray);
  74.   Var
  75.     X              : Array[1..6] of byte absolute PReal;
  76.   begin { MKS }
  77.   { Flip the exponent byte and try to pretend that X[2] & X[3] never existed   }
  78.       Move(X[4],BReal[1],3);
  79.       BReal[4] := X[1];
  80.   end;  { MKS }
  81.  
  82.   Procedure WritePCB12;
  83.   type
  84.     PCB12FileType   = record             { 128 Bytes for PCBOARD version 12.1  }
  85.            Display  : Ascii2;            { Sysop's Display ON/OFF              }
  86.            Printer  : Ascii2;            { Sysop's Printer ON/OFF              }
  87.            PageBell : Ascii2;            { Sysop's Page Bell ON/OFF            }
  88.            CallAlarm: Ascii2;            { Caller Alarm ON/OFF                 }
  89.            SysopNext: Ascii2;            { Sysop "Next On" Flag                }
  90.            BaudRate : Ascii4;            { "CONNECT" Baud Rate of Caller       }
  91.            Name     : Ascii27;           { Full Name of Caller (plus 2 spaces) }
  92.            FirstName: Ascii15;           { First Name of Caller                }
  93.            Graphics : Ascii2;            { Graphics Mode of Caller             }
  94.            Password : Ascii12;           { Password of Caller                  }
  95.            RecordNum: Integer;           { User's Database Record Number (MKI$)}
  96.            TimeLogOn: BasArray;          { Time User Logged On   (MKS$ seconds)}
  97.            TimeAllow: BasArray;          { User's Allowed Time   (MKS$ seconds)}
  98.            TimeDoor : BasArray;          { Time Exited to Door   (MKS$ seconds)}
  99.            LogONStattattr : Ascii5;            { Time User Logged On          (HH:MM)}
  100.            ConfExit : Ascii2;            { Area Exited to DOS   (not converted)}
  101.            ConfFlags: Ascii18;           { Areas "Joined" Flags (not converted)}
  102.            ConfTime : Ascii2;            { Area "Bonus" Time    (not converted)}
  103.            ByteLmtDL: Ascii8;            { Daily Download Limit (not converted)}
  104.            TimeCred : Integer;           { Upload Time Bonus Earned      (MKI$)}
  105.            Language : Ascii4;            { Language Version Being Used         }
  106.            ModemType: Ascii2;            { Error Correcting Modem YES/NO       }
  107.            NodeChat : Char;              { Node Chat Status Flag               }
  108.          end;
  109.  
  110.   var
  111.     SS             : string;
  112.     P12            : PCB12FileType;
  113.     P12F           : file of PCB12FileType;
  114.     BR             : BasArray;
  115.  
  116.   begin
  117.     With P12 Do
  118.     begin
  119.       Display:='-1';
  120.       Printer:=' 0';
  121.       PageBell:=' 0';
  122.       CallAlarm:=' 0';
  123.       SysopNext:='N '; { 'N ', 'X ', '  '}
  124.       if (NStat.ConnectSpeed.ModemSpeed=0) then
  125.         BaudRate:='Loca'
  126.       Else
  127.       begin
  128.         SS:=Fill(I2S(NStat.ConnectSpeed.ModemSpeed,0),5,#32);
  129.         Move(SS[1],BaudRate,4);
  130.       end;
  131.       SS:=Fill(NStat.UserName,27,#32);
  132.       Move(SS[1],Name,27);
  133.       SS:=Fill(GetFirst(SS),15,#32);
  134.       Move(SS[1],FirstName,15);
  135.       if not (IBM In NStat.Graphics) then
  136.         Graphics:='7E'
  137.       Else if not (ANSI In NStat.Graphics) then
  138.         Graphics:=' 0'
  139.       Else
  140.         Graphics:='-1';
  141.       Password:='            ';
  142.       if (UpStr(NStat.UserName) = SysCfg.SysOpName) then
  143.         RecordNum:=1
  144.       Else
  145.         RecordNum:=2;
  146.       MKS(NStat.Connected,BR);
  147.       TimeLogOn:=BR;
  148.       MKS(NStat.TimeAllowed * 60,BR);
  149.       TimeAllow:=BR;
  150.       MKS(TimeNow,BR);
  151.       TimeDoor:=BR;
  152.       SS:=TimeStr(NStat.Connected);
  153.       Move(SS[1],LogONStattattr,5);
  154.       ConfExit:='  ';
  155.       ConfFlags:='                  ';
  156.       ConfTime:='  ';
  157.       ByteLmtDL:='0       ';
  158.       TimeCred:=0;
  159.       Language:='.   ';
  160.       Language[2] := User.Language;
  161. {      if NStat.ConnectSpeed.MNP then
  162.         ModemType:='-1'
  163.       Else}
  164.         ModemType:=' 0';
  165.       NodeChat:='U';
  166.     end;
  167.  
  168.     Assign(P12F,'TEMP\' + I2S( NStat.NodeNo, 3 ) + '\PCBOARD.'+I2S(NStat.NodeNo,0));
  169.     ReWrite(P12F);
  170.     Write(P12F,P12);
  171.     Close(P12F);
  172.  
  173.     Writeln('PCBoard version 12.0 - PCBOARD.SYS file written');
  174.   end; { Procedure WritePCB12 }
  175.  
  176.   Procedure WritePCB14;
  177.   type
  178.     PCB14FileType   = record             { 128 Bytes for PCBOARD version 14.0  }
  179.            Display  : Ascii2;            { Sysop's Display ON/OFF              }
  180.            Printer  : Ascii2;            { Sysop's Printer ON/OFF              }
  181.            PageBell : Ascii2;            { Sysop's Page Bell ON/OFF            }
  182.            CallAlarm: Ascii2;            { Caller Alarm ON/OFF                 }
  183.            SysopNext: Char;              { Sysop "Next On" Flag                }
  184.            ModemType: Ascii2;            { Error Correcting Modem YES/NO       }
  185.            Graphics : Char;              { Graphics Mode of Caller             }
  186.            NodeChat : Char;              { Available for Node Chat YES/NO      }
  187.            BaudOpen : Ascii5;            { Baud Rate to Open Modem at          }
  188.            BaudRate : Ascii5;            { "CONNECT" Baud Rate of Caller       }
  189.            RecordNum: Integer;           { User's Database Record Number (MKI$)}
  190.            FirstName: Ascii15;           { First Name of Caller                }
  191.            Password : Ascii12;           { Password of Caller                  }
  192.            TimeLogOn: Integer;           { Time User Logged On   (MKI$ minutes)}
  193.            TimeUsed : Integer;           { Time Used Today       (MKI$ minutes)}
  194.            LogONStattattr : Ascii5;            { Time User Logged On       (HH:MM:SS)}
  195.            TimeLimit: Integer;           { Daily Time Limit      (MKI$ minutes)}
  196.            ByteLmtDL: Integer;           { Daily Download Limit  (MKI$ K-bytes)}
  197.            ConfExit : Char;              { Conference (Area) User Exited From  }
  198.            ConfFlags: Ascii5;            { Areas User Has "Joined" Today       }
  199.            ConfScan : Ascii5;            { Areas User Has Scanned for New Mail }
  200.            ConfTime : Integer;           { Area "Bonus" Time     (MKI$ minutes)}
  201.            TimeCred : Integer;           { Upload Time Credit    (MKI$ minutes)}
  202.            Language : Ascii4;            { Language Version Being Used         }
  203.            Name     : Ascii25;           { Full Name of Caller   (First & Last)}
  204.